package com.zhentao.pojo;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;

import java.util.Date;

/**
 * 海关数据采集主表：存储所有采集方式的原始数据
 * 根据业务流程需求设计，作为外部数据审计库（audit table）
 * @TableName data_collection
 */
@TableName(value ="data_collection")
@Data
public class DataCollection {
    /**
     * 采集记录ID
     */
    @TableId(type = IdType.AUTO)
    private Integer id;

    /**
     * 数据类型：1-FTP导入 2-CSV上报 3-手工录入 4-主动采集
     */
    private Integer dataType;

    /**
     * 关区（如洋山、边民互市）
     */
    private String customsArea;

    /**
     * 报关单号
     */
    private String declareNo;

    /**
     * 项号
     */
    private String itemNo;

    /**
     * 币制：1-人民币 2-美元
     */
    private Integer currencyType;

    /**
     * 金额（人民币）
     */
    private Double amountCny;

    /**
     * 金额（美元）
     */
    private Double amountUsd;

    /**
     * 商品数量
     */
    private Integer goodsQuantity;

    /**
     * 状态：1-待入库 2-已入库 3-异常
     */
    private Integer status;

    /**
     * 采集时间
     */
    private Date createTime;

    /**
     * 操作人id
     */
    private Integer userId;

    /**
     * 用户名（关联查询）
     */
    @TableField(exist = false)
    private String userName;

    /**
     * 进出口类型：IMPORT-进口, EXPORT-出口
     */
    private String importExportType;

    /**
     * 结关日期
     */
    @TableField(exist = false)
    private Date customsClearanceDate;

    /**
     * 企业名称
     */
    @TableField(exist = false)
    private String enterpriseName;

    /**
     * 企业代码
     */
    @TableField(exist = false)
    private String enterpriseCode;

    /**
     * 企业信用等级
     */
    @TableField(exist = false)
    private String enterpriseCreditLevel;

    /**
     * HS编码
     */
    @TableField(exist = false)
    private String hsCode;

    /**
     * 商品名称
     */
    @TableField(exist = false)
    private String goodsName;

    /**
     * 国别代码
     */
    @TableField(exist = false)
    private String countryCode;

    /**
     * 国别名称
     */
    @TableField(exist = false)
    private String countryName;

    /**
     * 口岸代码
     */
    @TableField(exist = false)
    private String portCode;

    /**
     * 口岸名称
     */
    @TableField(exist = false)
    private String portName;

    /**
     * 运输方式
     */
    @TableField(exist = false)
    private String transportMode;

    /**
     * 更新时间
     */
    @TableField(exist = false)
    private Date updateTime;

    /**
     * 列值参数（针对不同关区进行设置）
     */
    @TableField(exist = false)
    private String columnValueParams;

    /**
     * 处理状态：1-未处理 2-已处理 3-处理异常
     */
    @TableField(exist = false)
    private Integer processStatus;

    /**
     * 处理时间
     */
    @TableField(exist = false)
    private Date processTime;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        DataCollection other = (DataCollection) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
            && (this.getDataType() == null ? other.getDataType() == null : this.getDataType().equals(other.getDataType()))
            && (this.getCustomsArea() == null ? other.getCustomsArea() == null : this.getCustomsArea().equals(other.getCustomsArea()))
            && (this.getDeclareNo() == null ? other.getDeclareNo() == null : this.getDeclareNo().equals(other.getDeclareNo()))
            && (this.getItemNo() == null ? other.getItemNo() == null : this.getItemNo().equals(other.getItemNo()))
            && (this.getCurrencyType() == null ? other.getCurrencyType() == null : this.getCurrencyType().equals(other.getCurrencyType()))
            && (this.getAmountCny() == null ? other.getAmountCny() == null : this.getAmountCny().equals(other.getAmountCny()))
            && (this.getAmountUsd() == null ? other.getAmountUsd() == null : this.getAmountUsd().equals(other.getAmountUsd()))
            && (this.getGoodsQuantity() == null ? other.getGoodsQuantity() == null : this.getGoodsQuantity().equals(other.getGoodsQuantity()))
            && (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus()))
            && (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()))
            && (this.getUserId() == null ? other.getUserId() == null : this.getUserId().equals(other.getUserId()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getDataType() == null) ? 0 : getDataType().hashCode());
        result = prime * result + ((getCustomsArea() == null) ? 0 : getCustomsArea().hashCode());
        result = prime * result + ((getDeclareNo() == null) ? 0 : getDeclareNo().hashCode());
        result = prime * result + ((getItemNo() == null) ? 0 : getItemNo().hashCode());
        result = prime * result + ((getCurrencyType() == null) ? 0 : getCurrencyType().hashCode());
        result = prime * result + ((getAmountCny() == null) ? 0 : getAmountCny().hashCode());
        result = prime * result + ((getAmountUsd() == null) ? 0 : getAmountUsd().hashCode());
        result = prime * result + ((getGoodsQuantity() == null) ? 0 : getGoodsQuantity().hashCode());
        result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode());
        result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
        result = prime * result + ((getUserId() == null) ? 0 : getUserId().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", dataType=").append(dataType);
        sb.append(", customsArea=").append(customsArea);
        sb.append(", declareNo=").append(declareNo);
        sb.append(", itemNo=").append(itemNo);
        sb.append(", currencyType=").append(currencyType);
        sb.append(", amountCny=").append(amountCny);
        sb.append(", amountUsd=").append(amountUsd);
        sb.append(", goodsQuantity=").append(goodsQuantity);
        sb.append(", status=").append(status);
        sb.append(", createTime=").append(createTime);
        sb.append(", userId=").append(userId);
        sb.append(", importExportType=").append(importExportType);
        sb.append(", customsClearanceDate=").append(customsClearanceDate);
        sb.append(", enterpriseName=").append(enterpriseName);
        sb.append(", enterpriseCode=").append(enterpriseCode);
        sb.append(", enterpriseCreditLevel=").append(enterpriseCreditLevel);
        sb.append(", hsCode=").append(hsCode);
        sb.append(", goodsName=").append(goodsName);
        sb.append(", countryCode=").append(countryCode);
        sb.append(", countryName=").append(countryName);
        sb.append(", portCode=").append(portCode);
        sb.append(", portName=").append(portName);
        sb.append(", transportMode=").append(transportMode);
        sb.append(", updateTime=").append(updateTime);
        sb.append(", columnValueParams=").append(columnValueParams);
        sb.append(", processStatus=").append(processStatus);
        sb.append(", processTime=").append(processTime);
        sb.append("]");
        return sb.toString();
    }
}